<template>
  <div v-if="show" class="cover" @click="close">
    <div class="video_box p_c">
      <div class="close_btn" @click="close">X</div>
      <video class="video" controls autoplay>
        <source :src="src" type="video/mp4" />
        <source :src="src" type="video/ogg" />
        <source :src="src" type="video/webm" />
      </video>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    src: {
      type: String,
      default: "",
    },
    show: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    close() {
      this.$emit("close");
    },
  },
};
</script>

<style lang="scss" scoped>
.cover {
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  top: 0;
  left: 0;
  position: fixed;
  width: 100%;
  height: 100%;

  .video_box {
    position: relative;
    width: 800px;
    .video {
      width: 800px;
      max-height: 750px;
    }
    .close_btn {
      position: absolute;
      right: -50px;
      top: -35px;
      height: 30px;
      width: 30px;
      background: #fff;
      text-align: center;
      line-height: 30px;
      border-radius: 50%;
      font-size: 14px;
      cursor: pointer;
    }
  }
}
</style>